<?php
namespace App\Services;
use Illuminate\Support\Facades\Cache;
use Spatie\Image\Image;
use Spatie\Image\Manipulations;

class UploadService{
    public function image($file,$width=800,$height=800,$fit=Manipulations::FIT_CONTAIN){
        $filePath = $file->store('attachments');
        $realPath = storage_path('app/'.$filePath);
        Image::load($realPath)->fit($fit,$width,$height)->save();
        return url($filePath);
    }
}
